package com.shuyuntu.serviceImpl;

import java.sql.Connection;
import java.sql.Statement;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.shuyuntu.common.controller.JdbcController;
import com.shuyuntu.dao.IDogDao;
import com.shuyuntu.entity.Dog;
import com.shuyuntu.service.IDogService;

@Service
public class DogServiceImpl implements IDogService {

	
	private IDogDao dogDao;
	
	

	public Dog getDogId(Integer dogId) {
		Dog dog = new Dog();
		dog.setName("欢欢");
		dog.setBirthday("7月8日");
		dog.setAge(1);

		return dog;
	}

	public boolean addDog(Dog dog) throws Exception {
		Connection conn =JdbcController.getConnection();
		
		// 生成一条mysql语句
		String sql = "insert into th_dog ";
		Statement stmt = conn.createStatement();// 创建一个Statement对象
		stmt.executeUpdate(sql);// 执行sql语句
		return true;
	}
}
